import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SleepVO, SleepForm, SleepQuery } from '@/api/stroke/sleep/types';

/**
 * 查询健康指标--睡眠列表
 * @param query
 * @returns {*}
 */

export const listSleep = (query?: SleepQuery): AxiosPromise<SleepVO[]> => {
  return request({
    url: '/stroke/sleep/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询健康指标--睡眠详细
 * @param id
 */
export const getSleep = (id: string | number): AxiosPromise<SleepVO> => {
  return request({
    url: '/stroke/sleep/' + id,
    method: 'get'
  });
};

/**
 * 新增健康指标--睡眠
 * @param data
 */
export const addSleep = (data: SleepForm) => {
  return request({
    url: '/stroke/sleep',
    method: 'post',
    data: data
  });
};

/**
 * 修改健康指标--睡眠
 * @param data
 */
export const updateSleep = (data: SleepForm) => {
  return request({
    url: '/stroke/sleep',
    method: 'put',
    data: data
  });
};

/**
 * 删除健康指标--睡眠
 * @param id
 */
export const delSleep = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/sleep/' + id,
    method: 'delete'
  });
};
